/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.wx.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jeesite.common.config.Global;
import com.jeesite.common.entity.Page;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.wx.entity.WxUserActivityAfter;
import com.jeesite.modules.wx.service.WxUserActivityAfterService;

/**
 * wx_user_activity_afterController
 * @author wangjianxin
 * @version 2018-10-03
 */
@Controller
@RequestMapping(value = "${adminPath}/wx/wxUserActivityAfter")
public class WxUserActivityAfterController extends BaseController {

	@Autowired
	private WxUserActivityAfterService wxUserActivityAfterService;
	
	/**
	 * 获取数据
	 */
	@ModelAttribute
	public WxUserActivityAfter get(String id, boolean isNewRecord) {
		return wxUserActivityAfterService.get(id, isNewRecord);
	}
	
	/**
	 * 查询列表
	 */
	@RequiresPermissions("wx:wxUserActivityAfter:view")
	@RequestMapping(value = {"list", ""})
	public String list(WxUserActivityAfter wxUserActivityAfter, Model model) {
		model.addAttribute("wxUserActivityAfter", wxUserActivityAfter);
		return "modules/wx/wxUserActivityAfterList";
	}
	
	/**
	 * 查询列表数据
	 */
	@RequiresPermissions("wx:wxUserActivityAfter:view")
	@RequestMapping(value = "listData")
	@ResponseBody
	public Page<WxUserActivityAfter> listData(WxUserActivityAfter wxUserActivityAfter, HttpServletRequest request, HttpServletResponse response) {
		Page<WxUserActivityAfter> page = wxUserActivityAfterService.findPage(new Page<WxUserActivityAfter>(request, response), wxUserActivityAfter); 
		return page;
	}

	/**
	 * 查看编辑表单
	 */
	@RequiresPermissions("wx:wxUserActivityAfter:view")
	@RequestMapping(value = "form")
	public String form(WxUserActivityAfter wxUserActivityAfter, Model model) {
		model.addAttribute("wxUserActivityAfter", wxUserActivityAfter);
		return "modules/wx/wxUserActivityAfterForm";
	}

	/**
	 * 保存wx_user_activity_after
	 */
	@RequiresPermissions("wx:wxUserActivityAfter:edit")
	@PostMapping(value = "save")
	@ResponseBody
	public String save(@Validated WxUserActivityAfter wxUserActivityAfter) {
		wxUserActivityAfterService.save(wxUserActivityAfter);
		return renderResult(Global.TRUE, text("保存wx_user_activity_after成功！"));
	}
	
	/**
	 * 删除wx_user_activity_after
	 */
	@RequiresPermissions("wx:wxUserActivityAfter:edit")
	@RequestMapping(value = "delete")
	@ResponseBody
	public String delete(WxUserActivityAfter wxUserActivityAfter) {
		wxUserActivityAfterService.delete(wxUserActivityAfter);
		return renderResult(Global.TRUE, text("删除wx_user_activity_after成功！"));
	}
	
}